<template>
  <div>
    <ul class="item">
      <li v-for="(item ,index) of list" v-bind:key="index">{{item.name}}</li>
    </ul>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: 'Index',
  data: function () {
    return {
      list: []
    }
  },
  methods: {
    listhandle: function () {
      axios.get('./static/demo/list.json', {
        params: {
          id: 1
        }
      }).then(this.succHandle)
    },
    succHandle (res) {
      console.log(res)
      if (res.data.code && res.data.data.length > 0) {
        const result = res.data.data
        console.log(result)
        this.list = result
      }
    }
  },
  mounted () {
    this.listhandle()
  }
}
</script>

<style scoped>
.item {
  height: auto;
}
.item >li {
  border-bottom: 2px;
  height: 20px;
}

</style>
